package com.dog.basics.admin.controller.wishwash.admin;
import com.dog.basics.bean.dto.admin.common.AdminReportFormAgentDto;
import com.dog.basics.bean.dto.admin.common.AdminReportFormFileldDto;
import com.dog.basics.bean.vo.admin.wishwash.AdminReportFormAgentVo;
import com.dog.basics.bean.vo.admin.wishwash.AdminReportFormFileldVo;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.DogConnectFlowingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * 报表管理
 * guonh 2021年7月23日
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/form")
@Api(value = "报表管理", tags = "报表管理")
public class AdminReportFormController {

    private final DogConnectFlowingService flowingService;

    /***
     * 代理商收益信息
     * @param dto
     * @return
     */
    @ApiOperation(value = "代理商收益分页", notes = "admin_form_agent_view")
    @GetMapping("/agent")
    @PreAuthorize("@pms.hasPermission('admin_form_agent_view')")
    public R<AdminReportFormAgentVo> getAdminReportFormAgent(PageParam param, AdminReportFormAgentDto dto) {
        return R.ok(flowingService.getAdminReportFormAgent(param, dto));
    }

    /***
     * 场地收益信息
     * @param param
     * @param dto
     * @return
     */
    @ApiOperation(value = "场地收益分页", notes = "admin_form_fileld_view")
    @GetMapping("/fileld")
    @PreAuthorize("@pms.hasPermission('admin_form_fileld_view')")
    public R<AdminReportFormFileldVo> getAdminReportFormFileld(PageParam param, AdminReportFormFileldDto dto) {
        return R.ok(flowingService.getAdminReportFormFileld(param, dto));
    }


    /***
     * 代理商收益信息导出
     * @param dto
     * @return
     */
    @ApiOperation(value = "代理商收益信息导出", notes = "admin_form_agent_download")
    @PostMapping("/dow/agent")
    @PreAuthorize("@pms.hasPermission('admin_form_agent_download')")
    public void downloadAdminReportFormAgent(AdminReportFormAgentDto dto) {
        flowingService.downloadAdminReportFormAgent(dto);
    }

    /***
     * 场地收益信息导出
     * @param dto
     * @return
     */
    @ApiOperation(value = "场地收益信息导出", notes = "admin_form_fileld_download")
    @PostMapping("/dow/fileld")
    @PreAuthorize("@pms.hasPermission('admin_form_fileld_download')")
    public void downloadAdminReportFormFileld(AdminReportFormFileldDto dto) {
        flowingService.downloadAdminReportFormFileld(dto);
    }
}
